<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
     //   //补零
     //   function fn(num){
     //   return num < 10 ? '0' + num :num
     //   }
     //   //
     //   function fn2(second){
     //       second = isNaN(totalSecond) ? 0 :parseInt(totalSecond)
     //   
     //   
     //   let h = parseInt(totalSecond / 60 / 60 % 24)
     //   let m = parseInt(totalSecond / 60 % 60)
     //   let s = parseInt(totalSecond % 60)
     //   return `${fn(h)}:${fn(m)}:${fn(s)}`
     //   }
     //   let totalSecond = +prompt('请输入秒数')
     //   let result = fn2(totalSecond)
     //   console.log(`转化结果：${result}`)
     //   //document.write(h+'小时'+m+'分钟'+s+'秒')

    let seconds = +prompt('请输入秒数')
    function getTime(t){
        if(t <= 0){
            alert('必须大于0')
            return
        }
        let h = parseInt(t / 60 / 60 % 24)
        let m = parseInt(t / 60 % 60)
        let s = parseInt(t % 60)
        h = h < 10? '0' + h : h
        m = m < 10? '0' + m : m
        s = s < 10? '0' + s : s
        return `转换完毕的结果为:${h}小时${m}分钟${s}秒 `
    }

    document.write(getTime(seconds))
    </script>
</body>
</html>